<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" 	uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" 	%>
<%@ taglib prefix="sql" uri="http://java.sun.com/jsp/jstl/sql" 	%>

<sql:setDataSource var="oracleDs" scope="application" 
	driver="oracle.jdbc.OracleDriver" 
	url="jdbc:oracle:thin:@//127.0.0.1:1521/orcl" 
	user="SmartContent"  password="SmartContent" />

<sql:query var="dualTable" dataSource="${oracleDs}" >
	select SYSDATE from dual
</sql:query>

<jsp:useBean id="chatMsgList" 	class="chat.bean.ChatMsgList" 	scope="application" />
<jsp:useBean id="chatMsg" 		class="chat.bean.ChatMsg" 		scope="request" 	/>

<jsp:setProperty name="chatMsg" 	property="*" />
<jsp:setProperty name="chatMsgList" property="addChatMsg" value="${ chatMsg }" />

<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>

<jsp:useBean id="now" class="java.util.Date"/>    
<fmt:formatDate value="${now}" dateStyle="long"/>
<fmt:formatDate value="${now}" pattern="dd-MM-yyyy HH:mm:ss a z" />

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" >
	<meta http-equiv="refresh" 		content="5;URL=chatView.jsp" >
	
	<title>JSP Chat Message List View</title>
</head>
<body>
	<div>
		<ul>
			<c:forEach items="${chatMsgList}" var="it" varStatus="status" >
				<li>
					<fmt:formatNumber type="number" pattern="000" 	  value="${ status.index + 1 }" />  : 
					<fmt:formatDate	  type="time" 	timeStyle="short" value="${ it.msgDate }"       />
				</li>
				<li> ${ it.userName } : ${it.msgText } </li>
			</c:forEach> 
		</ul>
	</div>
</body>
</html>